﻿<%@ Page Language="C#" MasterPageFile="~/MMhome.Master" AutoEventWireup="true" CodeBehind="MruleManage.aspx.cs"
    Inherits="MobileManager.MruleManage" Title="规则管理" %>

<%@ Register Src="~/UserControl/ProvinceListQuick.ascx" TagName="Province" TagPrefix="uc2" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script language="javascript" type="text/javascript" src="Js/UCcalendar/WdatePicker.js"></script>

    <script type="text/javascript">
        function AddNew() {
            window.location.href = "MruleManageEdit.aspx";
            return false;
        }

        function AddNewMone() {
            window.location.href = "MruleManageAdd.aspx";
            return false;
        }

        function AllFun(Mess) {
            var strIDS = document.getElementById('<%=hdfBoxValues.ClientID%>').value;
            if (strIDS == "") {
                alert("请选择要" + Mess + "的项！");
                return false;
            }
            return confirm("确认要" + Mess + "？");
        }

        function ClickBox(obj) {
            if (obj.checked == true) {
                document.getElementById('<%=hdfBoxValues.ClientID%>').value += obj.value + ",";
            }
            else {
                document.getElementById('<%=hdfBoxValues.ClientID%>').value = document.getElementById('<%=hdfBoxValues.ClientID%>').value.replace(obj.value + ",", "");
            }
        }

        function ClickBoxAll(obj) {
            if (obj.checked == true) {
                var items = document.getElementsByName("myBox");
                for (var i = 0; i < items.length; i++) {
                    items[i].checked = true;
                    document.getElementById('<%=hdfBoxValues.ClientID%>').value += items[i].value + ",";
                }
            }
            else {
                var items = document.getElementsByName("myBox");
                for (var i = 0; i < items.length; i++) {
                    items[i].checked = false;
                }
                document.getElementById('<%=hdfBoxValues.ClientID%>').value = "";
            }
        }
    </script>

    <style type="text/css">
        .lbCursor
        {
            cursor: pointer;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">
    <div style="width: 95%; text-align: center; font-size: 12px; margin-top: 15px;">
        <div style="width: 100%; text-align: center;">
            <table>
                <tr>
                    <td>
                        查询条件&nbsp;&nbsp;
                    </td>
                    <td style="text-align: right;">
                        省份：
                    </td>
                    <td style="text-align: left">
                        <uc2:Province ID="txtProvince" runat="server" />
                    </td>
                    <td style="text-align: right;">
                        运营商编号：
                    </td>
                    <td style="text-align: left">
                        <asp:DropDownList ID="ddlODEP" runat="server" CssClass="dropnormal">
                        </asp:DropDownList>
                    </td>
                    <td>
                        状态：
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlStatus" runat="server">
                            <asp:ListItem Value="-1" Text="全部"></asp:ListItem>
                            <asp:ListItem Value="0" Text="关闭"></asp:ListItem>
                            <asp:ListItem Value="1" Text="开启"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td>
                        下次联网时间：
                    </td>
                    <td>
                        <input class="Wdate" id="inputDate" name="inputDateStart" runat="server" type="text"
                            onclick="WdatePicker()" />
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td style="text-align: right;">
                        客户编号：
                    </td>
                    <td style="text-align: left;">
                        <asp:DropDownList ID="ddlCustomer" runat="server" CssClass="dropnormal">
                        </asp:DropDownList>
                    </td>
                    <td style="text-align: right;">
                        通道编号：
                    </td>
                    <td style="text-align: left" colspan="3">
                        <asp:DropDownList ID="ddlChannel" runat="server" CssClass="dropnormal">
                        </asp:DropDownList>
                    </td>
                    <td colspan="2">
                        <asp:DropDownList ID="ddlOrder" runat="server">
                            <asp:ListItem Value="CreateTime" Text="创建时间" Selected="True"></asp:ListItem>
                            <asp:ListItem Value="PinYinCode" Text="省份"></asp:ListItem>
                            <asp:ListItem Value="CNO" Text="客户编号"></asp:ListItem>
                            <asp:ListItem Value="ChannelNO" Text="通道编号"></asp:ListItem>
                            <asp:ListItem Value="NextTime" Text="下次联网时间"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:DropDownList ID="ddlAD" runat="server">
                            <asp:ListItem Value="ASC" Text="升序"></asp:ListItem>
                            <asp:ListItem Value="DESC" Text="降序" Selected="True"></asp:ListItem>
                        </asp:DropDownList>
                        &nbsp;&nbsp;&nbsp;<asp:Button ID="btnQuery" runat="server" Text="查 询" CssClass="button_green"
                            Width="70px" OnClick="btnQuery_Click" />
                    </td>
                </tr>
            </table>
        </div>
        <div style="width: 100%; text-align: left;">
            <asp:Button ID="btnON" Text="开 启" runat="server" CssClass="button_blue" Width="60px"
                OnClientClick="return AllFun('开启');" OnClick="btnON_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnOff" Text="关 闭" runat="server" CssClass="button_blue" Width="60px"
                OnClientClick="return AllFun('关闭');" OnClick="btnOff_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnDeleteAll" Text="删 除" runat="server" CssClass="button_blue" Width="60px"
                OnClientClick="return AllFun('删除');" OnClick="btnDeleteAll_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnADDNew" runat="server" Text="添加单个规则" OnClientClick="return AddNew();"
                CssClass="button_blue" />&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnADDMone" runat="server" Text="添加多个规则" OnClientClick="return AddNewMone();"
                CssClass="button_blue" />
        </div>
        <div style="text-align: left; width: 100%">
            <asp:Label ID="lbCount" runat="server"></asp:Label>
        </div>
        <asp:GridView ID="GVinfo" runat="server" AutoGenerateColumns="False" CssClass="reason_box"
            Font-Size="12px" CellPadding="0" BorderWidth="0px" BorderColor="#A6E1FF" Width="100%"
            OnRowDataBound="GVinfo_RowDataBound" OnRowCancelingEdit="GVinfo_RowCancelingEdit"
            OnRowDeleting="GVinfo_RowDeleting" OnRowEditing="GVinfo_RowEditing" AllowPaging="True"
            PageSize="20">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <input type="checkbox" name="myBox" id="cbox" value='<%# Eval("ID") %>' onclick="ClickBox(this)" />
                    </ItemTemplate>
                    <HeaderTemplate>
                        <input type="checkbox" name="myBoxAll" id="cboxAll" onclick="ClickBoxAll(this)" />
                    </HeaderTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="省份">
                    <ItemTemplate>
                        <asp:Label ID="lbProvinceName" runat="server" Text='<%# Bind("ProvinceName") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="运营商">
                    <ItemTemplate>
                        <asp:Label ID="lbODEPName" runat="server" Text='<%# Bind("ONO") %>' CssClass="lbCursor"
                            ToolTip='<%# Bind("OName") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="客户">
                    <ItemTemplate>
                        <asp:Label ID="lbCustomerName" runat="server" Text='<%#Eval("CNO") %>' CssClass="lbCursor"
                            ToolTip='<%# Bind("CName") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="通道">
                    <ItemTemplate>
                        <asp:Label ID="lbChannelNO" runat="server" Text='<%#Eval("ChannelNO") %>' CssClass="lbCursor"
                            ToolTip='<%# Bind("ChannelName") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="发送条数">
                    <ItemTemplate>
                        <asp:Label ID="lbSendCount" runat="server" Text='<%#Eval("SendCount") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="下次联网时间">
                    <ItemTemplate>
                        <asp:Label ID="lbNextTime" runat="server" Text='<%#Eval("NextTime") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="更新时间间隔(天)">
                    <ItemTemplate>
                        <asp:Label ID="lbTimeInterval" runat="server" Text='<%#Eval("TimeInterval") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="状态">
                    <ItemTemplate>
                        <asp:Label ID="lbStatus" runat="server" Text='<%#Eval("Status") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="管理">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="编辑"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
                            Text="删除" OnClientClick="return confirm('确定要删除?')"></asp:LinkButton><asp:HiddenField
                                ID="HF1" runat="server" Value='<%#Eval("ID") %>' />
                    </ItemTemplate>
                    <HeaderStyle BorderColor="#4DA6FF" BorderWidth="1px" />
                    <ItemStyle BorderColor="#4DA6FF" BorderWidth="1px" Width="80px" />
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <span style="color: Red; font-weight: bold;">没有数据！</span>
            </EmptyDataTemplate>
        </asp:GridView>
        <div style="padding-top: 10px; text-align: right;">
            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_PageChanged"
                PageSize="20" FirstPageText="首页" LastPageText="末页" NextPageText="下一页" PrevPageText="上一页"
                ShowBoxThreshold="999">
            </webdiyer:AspNetPager>
        </div>
        <asp:HiddenField ID="hdfBoxValues" runat="server" />
    </div>
</asp:Content>
